from py_page.base_page import BasePage


class MyPage(BasePage):
    # path = r"C:\Users\37210\Desktop\测开班_16\app_ui_frame16\py_yaml\my_page.yaml"
    path = BasePage.get_path("/py_yaml/my_page.yaml")

    # 跳转到登录页面
    def goto_login_page(self):
        self.run_steps(self.path, "goto_login_page")
        from py_page.login_page import LoginPage
        return LoginPage(self.driver)

    # 在登录页面获取登录的用户名
    def get_login_name(self):
        ele = self.run_steps(self.path, "get_login_name")
        login_name = ele.get_attribute("text")
        return login_name

    # 跳转到首页
    def goto_main_page(self):
        self.run_steps(self.path, "goto_main_page")
        from py_page.main_page import MainPage
        return MainPage(self.driver)

    # 进入讨论列表
    def goto_discussion_list(self):
        self.run_steps(self.path, "goto_discussion_list")
        from py_page.discussion_page import DiscussionPage
        return DiscussionPage(self.driver)

    # 进入【沪深】的webview
    def goto_hushen_webView(self):
        self.run_steps(self.path, "goto_hushen_webView")
        webView_list = self.driver.contexts
        print(webView_list)

